package day06_exception_collection.com.itheima.d6_set;

import java.util.Comparator;
import java.util.TreeSet;

public class Demo5_Set {
    public static void main(String[] args) {
        TreeSet<Girl> set = new TreeSet<>(new Comparator<Girl>() {
            @Override
            public int compare(Girl o1, Girl o2) {
                return Double.compare(o1.getHeight(), o2.getHeight());
            }
        });
        set.add(new Girl("小花", '女', 18, 1.68));
        set.add(new Girl("赵敏", '女', 21, 169.5));
        set.add(new Girl("刘亦菲", '女', 34, 167.5));
        set.add(new Girl("李若彤", '女', 26, 168.5));
        set.add(new Girl("章若楠", '女', 19, 171.5));
        set.add(new Girl("杨幂", '女', 34, 172.5));

        System.out.println("set = " + set); 

    }
}
